var IndexSwipe = { 
	init: function(tab){ 
		n=$('.linebox li').size();             
        var wh=100*n+"%";
        $('.linebox').width(wh);
        var lt=(100/n);
        var lt_li=lt+"%";
        $('.linebox li').width(lt_li);         
        var y=0;      
        SetLS("swipenum",0);    
        if (tab == "event" || tab == "newperson" || tab == "findjob" || tab == "attendactivity" || tab == "myactivity" || tab == "news")
            $('#header .im_bottom:eq(0)').removeClass('visib');    
        $(".linebox").swipe( {                 
            swipeLeft:function() {
                if(GetLS("swipenum")==n-1){
                    //alert('已经到最后页');
                }else{
                	var num = GetLS("swipenum")?GetLS("swipenum"):0;
                	num ++;
                    y=num*lt;                             
                    var t=y;      

                    Res.borderSwitch(num,n);             
                    $(this).css({'-webkit-transform':"translate(-"+t+"%)",'-webkit-transition':'200ms linear'} ); 
                    SetLS("swipenum",num);

                    $(".line").css({'-webkit-transform':"translate(-"+((num+1)*lt/2)+"%)",'-webkit-transition':'200ms linear'} ); 
                    $(".line>li:eq(" + num + ")").addClass("selected").siblings().removeClass("selected");

                    $(".im_bottom").addClass("visib"); 
                    if (tab == "event"){ 
            			$('#header .im_bottom:eq(' + num + ')').removeClass('visib');    
            		}
                }
            },
            swipeRight:function() {
                if(GetLS("swipenum")==0){
                    //alert('已经到第一页') 
                }else{
                	var num = GetLS("swipenum")?GetLS("swipenum"):n-1;
                	num--;
                    y=num*lt;
                    var t=y;

                    Res.borderSwitch(num,n);   
                    $(this).css({'-webkit-transform':"translate(-"+t+"%)",'-webkit-transition':'200ms linear'} ); 
                    SetLS("swipenum",num);

                    $(".line").css({'-webkit-transform':"translate(-"+num*lt/2+"%)",'-webkit-transition':'200ms linear'} ); 
                    $(".line>li:eq(" + num + ")").addClass("selected").siblings().removeClass("selected");

                    $(".im_bottom").addClass("visib");
                    if (tab == "event" || tab == "newperson" || tab == "findjob" || tab == "attendactivity" || tab == "myactivity" || tab == "news"){ 
            			$('#header .im_bottom:eq(' + num + ')').removeClass('visib');     
            		}
                }
                
            }
        });
	},
	translate: function(num,length){ 
		var t = 100*num/length + "%";
		$(".linebox").css({'-webkit-transform':"translate(-"+t+")",'-webkit-transition':'200ms linear'} );
	},
    headerTranslate: function(num,length){
        SetLS("swipenum",num); 
        var t = 100*num/length/2 + "%";
        $(".line").css({'-webkit-transform':"translate(-"+t+")",'-webkit-transition':'200ms linear'} );
        $(".line>li:eq(" + num + ")").addClass("selected").siblings().removeClass("selected");
        IndexSwipe.translate(num,length);
    },
    headerInit: function(){
        n=$('.box_163css>.line>li').size();             
        var lt=(100/n);
        var lt_li=lt+"%";
        $('.line li').width(lt_li);         
        var y=0;      
        SetLS("swipenum",0);      
        $(".line").swipe( {                 
            swipeLeft:function() {
                if(GetLS("swipenum")==n-1){
                    //alert('已经到最后页');
                }else{
                    var num = GetLS("swipenum")?GetLS("swipenum"):0;
                    num ++;
                    y=(num+1)*lt;                             
                    var t=y/2;      
    
                    $(this).css({'-webkit-transform':"translate(-"+t+"%)",'-webkit-transition':'200ms linear'} ); 
                    $(".line>li:eq(" + num + ")").addClass("selected").siblings().removeClass("selected");
                    SetLS("swipenum",num);

                    $(".linebox").css({'-webkit-transform':"translate(-"+num*lt+"%)",'-webkit-transition':'200ms linear'} ); 
                }
            },
            swipeRight:function() {
                if(GetLS("swipenum")==0){
                    //alert('已经到第一页') 
                }else{
                    var num = GetLS("swipenum")?GetLS("swipenum"):n-1;
                    num--;
                    y=num*lt;
                    var t=y/2;

                    $(this).css({'-webkit-transform':"translate(-"+t+"%)",'-webkit-transition':'200ms linear'} );
                    $(".line>li:eq(" + num + ")").addClass("selected").siblings().removeClass("selected"); 
                    SetLS("swipenum",num);

                    $(".linebox").css({'-webkit-transform':"translate(-"+num*lt+"%)",'-webkit-transition':'200ms linear'} ); 
                }
                
            }
        });
    }
}